import request from '../axios/axios.js'

//流程配置节点
export const queryProcessInfo = (data,params) => {
    return request({
        url: '/dms/process/queryProcessInfo',
        method: 'post',
        data,
        params
    })
}
//节点查询
export const queryPage = (data,params) => {
    return request({
        url: '/dms/process/queryPage',
        method: 'post',
        data,
        params
    })
}
//流程配置节点-新增
export const addProcessInfo = (data,params) => {
    return request({
        url: '/dms/process/add',
        method: 'post',
        data,
        params
    })
}
//流程配置节点-编辑
export const editProcessInfo = (data,params) => {
    return request({
        url: '/dms/process/edit',
        method: 'post',
        data,
        params
    })
}
//流程配置节点-删除
export const delProcessInfo = (data,params) => {
    return request({
        url: '/dms/process/deleteBatch',
        method: 'post',
        data,
        params
    })
}
//月历看板
export const getMaintenanceMonth = (params) => {
    return request({
        url: '/dms/calendar/board/maintenanceMonth',
        method: 'get',
        params
    })
}
//年历看板
export const getMaintenanceYear = (params) => {
    return request({
        url: '/dms/calendar/board/maintenanceYear',
        method: 'get',
        params
    })
}

// 下拉框获取用户信息
export const getUserSelect = (params) => {
    return request({
        url: '/basic/user/searchOAUser',
        method: 'get',
        params: {
            key: params
        }
    })
}

// 下拉框获取公司信息
export const getCompanyList = () => {
    return request({
        // url: '/basic/company/getCompanyListByUser',
        url: '/dms/dmsBackupConfig/getCompanyList',
        method: 'get'
    })
}

// 下拉框根据公司查询仓库信息
export const getBackupsByCompany = (params) => {
    return request({
        url: '/dms/dmsBackupConfig/queryBackupsByCompany',
        method: 'post',
        data: params
    })
}

// 下拉框根据仓库查询货架信息
export const getShelfByBackupId = (params) => {
    return request({
        url: '/dms/dmsBackupConfig/queryShelfByBackupId',
        method: 'post',
        data: params
    })
}

// 下拉框根据货架查询库位信息
export const getLocationByShelfId = (params) => {
    return request({
        url: '/dms/dmsBackupShelfConfig/queryLocationByShelfId',
        method: 'post',
        data: params
    })
}
//报废库位
export const baogetLocationByShelfId = (params) => {
    return request({
        url: '/dms/backup/scrapApply/queryLocations',
        method: 'post',
        data: params
    })
}

//公司
export const getCompany = (params) => {
    return request({
        url: '/dms/dmsBackupConfig/getCompanyList',
        method: 'get',
        params:  params
    })
}

//查询全量有效仓库
export const getBackups= (params) => {
    return request({
        url: '/dms/dmsBackupConfig/queryBackups',
        method: 'post',
        data:  params
    })
}

//根据公司名称查仓库
export const getBackup = (params) => {
    return request({
        url: '/dms/dmsBackupConfig/queryBackupsByCompany',
        method: 'post',
        data: params
    })
}

//根据仓库id查询对应货架
export const getShelf = (params) => {
    return request({
        url: '/dms/dmsBackupConfig/queryShelfByBackupId',
        method: 'post',
        data:  params
    })
}

//根据货架id查询对应库位
export const getLocation = (params) => {
    return request({
        url: '/dms/dmsBackupShelfConfig/queryLocationByShelfId',
        method: 'post',
        data:  params
    })
}

// 根据当前登陆人查询工厂模型（设备安装位置）
export const findOrgByToken = (params) => {
    return request({
        url: '/basic/organization/findListByToken',
        method: 'get',
        params: params
    })
}

// 获取料号(物料配置查询接口)
// export const searchApi = (params) => {
//     return request({
//         method: 'post',
//         url: '/dms/dmsBackupMaterielConfig/queryPage',
//         data: params
//     })
// }
// 下拉框模糊搜索角色
export const getRoleByName = (params) => {
    return request({
        url: '/basic/roleSuperior/queryRoleByName',
        method: 'get',
        params: params
    })
}

// 下拉框模糊搜索料号
export const getMateriels = (params) => {
    return request({
        url: '/dms/dmsBackupMaterielConfig/queryMateriels',
        method: 'post',
        data: params
    })
}

// 根据公司/安装位置 查询设备
export const selectDeviceList = (params) => {
    return request({
        url: '/dms/interval/selectDeviceList',
        method: 'post',
        data: params
    })
}

// 查询某个层级的工厂建模
export const findOrgByLevel = (params) => {
    return request({
        url: '/dms/shift/findOrgByLevel',
        method: 'get',
        params: params
    })
}
// 查询某个层级的工厂建模
export const getUsers = (params) => {
    return request({
        url: '/dms/workOrder/getUsers',
        method: 'post',
        data: params
    })
}

// 查询某个层级的工厂建模
export const deviceNoAndAssetsNo = (params) => {
    return request({
        url: '/dms/dmsDevice/deviceNoAndAssetsNo',
        method: 'get',
        params
    })
}
export const getDictData = (name) => {
    return request({
        url: '/dms/faultCategory/dictList',
        method: 'get',
        params:{
            name,
        }
    })
}
